﻿using System;
using CGSB.AppCode;
using CDCW.Data;
using CDCW.API;

namespace CGSB.View
{
    public partial class AassignUser :BasePage
    {
        public string[] arrUsers
        {
            get { return hidCheckNodes.Value.ToString().TrimEnd(',').Split(','); }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int intRoleCode = int.Parse(Request.QueryString["RoleCode"] ?? "0");
                hidCheckNodes.Value = new JH_Auth_UserRoleB().GetUserByRoleCode(intRoleCode);
            }
        }

        protected void btAssignMenu_Click(object sender, EventArgs e)
        {
            int intRoleCode = int.Parse(Request.QueryString["RoleCode"] ?? "0");

            if (new JH_Auth_UserRoleB().AssignUser(arrUsers, intRoleCode) == "Success")
            {
                AlertMSG("3", "操作成功！");
            }
            else
            {
            }
        }
    }
}
